﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;

namespace WholeSlideImageViewer
{
    internal class WebStartup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            // Controllers
            services.AddControllers();
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            // 开发配置
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles(new StaticFileOptions
            {
                FileProvider = new EmbeddedFileProvider(typeof(WebStartup).Assembly, "WholeSlideImageViewer.ClientApp")
            });

            // Endpoint Routing 路由选择
            app.UseRouting();

            // 配置路由路径
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDeepZoom();
            });

        }
    }
}
